#!/bin/bash
# school: www.oldboyedu.com
# class: linux85
# auther: JasonYin

# docker build  --build-arg apps=bird  -f dockerfile/bird.yaml -t harbor.oldboyedu.com/games/bird:v1  /root/dockerfile/homework
# docker build  --build-arg apps=chengbao  -f dockerfile/chengbao.yaml -t harbor.oldboyedu.com/games/chengbao:v1  /root/dockerfile/homework
# docker build  --build-arg apps=pingtai  -f dockerfile/pingtai.yaml -t harbor.oldboyedu.com/games/pingtai:v1  /root/dockerfile/homework
# docker build  --build-arg apps=pinshu  -f dockerfile/pinshu.yaml -t harbor.oldboyedu.com/games/pinshu:v1  /root/dockerfile/homework
# docker build  --build-arg apps=tanke  -f dockerfile/tanke.yaml -t harbor.oldboyedu.com/games/tanke:v1  /root/dockerfile/homework

APPS=("bird" "chengbao" "pingtai" "pinshu" "tanke")
WORKDIR=/root/dockerfile/homework
PROJECT=harbor.oldboyedu.com/games
VERSION=v1
USERNAME=admin
PASSWORD=1
SERVER=harbor.oldboyedu.com

docker login -u $USERNAME -p $PASSWORD  $SERVER

for app in ${APPS[@]}
do
  docker build  --build-arg apps=${app}  -f dockerfile/${app}.yaml -t ${PROJECT}/${app}:${VERSION}  ${WORKDIR}
  docker push harbor.oldboyedu.com/games/${app}:v1
done

docker logout  $SERVER
